#include "Render/CgShader.h"

namespace vital {

	//--------------------------------------------------------------------------
	TCgShader::TCgShader(const CGtechnique &technique):
		mCgTechnique(technique),
		mCurPass(-1) {
		
		CGpass pass = cgGetFirstPass(mCgTechnique);

		while(pass) {
			mPasses.push_back(pass);
			pass = cgGetNextPass(pass);
		}
	}

	//--------------------------------------------------------------------------
	TCgShader::~TCgShader() {

	}

	//--------------------------------------------------------------------------
	size_t TCgShader::beginRender() {

		return mPasses.size();
	}

	//--------------------------------------------------------------------------
	void TCgShader::beginPass(size_t passId) {
		mCurPass = passId;
		cgSetPassState(mPasses[mCurPass]);
	}

	//--------------------------------------------------------------------------
	void TCgShader::endPass() {
		if(mCurPass != -1)
			cgResetPassState(mPasses[mCurPass]);
	}

	//--------------------------------------------------------------------------
	void TCgShader::endRender() {

	}

	//--------------------------------------------------------------------------

}